package com.uphone.kingmall.activity.personal;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.lzy.okgo.model.HttpParams;
import com.uphone.kingmall.activity.GoodsDetailActivity;
import com.uphone.kingmall.adapter.FavoriteAdapter;
import com.uphone.kingmall.base.BaseSearchListActivity;
import com.uphone.kingmall.bean.UserCollectGoodsBean;
import com.uphone.kingmall.utils.CommonUtil;
import com.uphone.kingmall.utils.HttpParamsUtils;
import com.uphone.kingmall.utils.MyUrl;

/**
 * <pre>
 *     author : radish
 *     e-mail : 15703379121@163.com
 *     time   : 2019/3/28
 *     desc   :
 * </pre>
 */
public class FavoritesSearchActivity extends BaseSearchListActivity<UserCollectGoodsBean, UserCollectGoodsBean.DataBean> {
    @Override
    protected void itemClick(BaseQuickAdapter adapter, View view, int position) {
        CommonUtil.startIntent(this, GoodsDetailActivity.class, dataList.get(position).getGoodsId());

    }

    @Override
    protected BaseQuickAdapter initAdapter() {
        return new FavoriteAdapter();
    }

    @Override
    protected UserCollectGoodsBean getBeans() {
        return new UserCollectGoodsBean();
    }

    @Override
    protected HttpParams getParams() {
        HttpParams params = HttpParamsUtils.getInstance().put("page", page)
                .put("limit", 10).getParams();
        if (!CommonUtil.checkViewEmpty(etContent)) {
            params.put("keyword", etContent.getText().toString().trim());
        }
        return params;
    }

    @Override
    protected String getUrl() {
        return MyUrl.getUserCollectGoods;
    }
}
